﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MINERP.MobileMsgSend.Forms
{
    public partial class FrmSearchReceive : Form
    {
        public FrmSearchReceive()
        {
            InitializeComponent();
        }

        private void simpleButtonOk_Click(object sender, EventArgs e)
        {
            string strSQL = " 1=1 ";
            if (!string.IsNullOrEmpty(textBoxUShouxinren.Text.Trim()))
            {
                strSQL += " and it.SendFormShop like'%" + textBoxUShouxinren.Text.Trim() + "%' ";
            }
            if (!string.IsNullOrEmpty(textBoxUContent.Text.Trim()))
            {
                strSQL += " and it.ReceiveContent like'%" + textBoxUContent.Text.Trim() + "%' ";

            }
          
            if (checkEdit1.Checked)
            {
                strSQL += "  and it.ReceiveTime > cast('" + dateEditUCreateStart.DateTime + "' as System.DateTime) and it.ReceiveTime< cast('" + dateEditUCreateEnd.DateTime + "' as System.DateTime) ";

            }
            PostSqlStr(strSQL);
            this.Close();
        }
        public delegate void PostStr(string inStr);
        public event PostStr PostSqlStr;
        private void checkEdit1_CheckStateChanged(object sender, EventArgs e)
        {
            if (checkEdit1.Checked)
            {
                dateEditUCreateStart.Enabled = true;
                dateEditUCreateEnd.Enabled = true;
                dateEditUCreateStart.DateTime = DateTime.Now;
                dateEditUCreateEnd.DateTime = DateTime.Now;
            }
            else
            {
                dateEditUCreateStart.Enabled = false;
                dateEditUCreateEnd.Enabled = false;
            }
        }

        private void FrmSearchReceive_Load(object sender, EventArgs e)
        {
            checkEdit1.Checked = false;
        }

        private void simpleButtonCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        
    }
}
